var vAliWapPay = new Vue({
    el: '#aliWapPay',
    data: function () {
        return {
            totalAmount: ''
        }
    },
    mounted() {

    },
    methods: {}
});



function recharge() {
    if (vAliWapPay.totalAmount === '' || vAliWapPay.totalAmount === null) {
    	alert("请输入充值金额！");
//        vAliWapPay.$Message.info("请输入充值金额！");
    }
    let data = {
        outTradeNo: GetDateNow(),
        totalAmount: vAliWapPay.totalAmount,
        subject: '订单名称',
        body: '商品描述',
    };
    let url ="/aliWapPay/wapPay";
    callAjaxPost(url, data, submitSuc);
}

function submitSuc(data) {
	// 创建div
	const div = document.createElement('pay'); 
	// 将返回的form 放入div
	div.innerHTML = data.obj; 
	// 将div放入body中
	var body = "<body>"+div.innerHTML +"</body>"
	// 打开一个空白页面
	var newwindow = window.open('');
	// 将body渲染进空白页面中
	newwindow.document.write(body);
	
//    const div = document.createElement('pay'); // 创建div
//    div.innerHTML = data.obj; // 将返回的form 放入div
//    document.body.appendChild(div);
//    document.forms[0].submit();
}


/**
 * 获取当前时间，返回时间字符串
 * @returns {string} 时间字符串
 * @constructor
 */
function GetDateNow() {
    var vNow = new Date();
    var sNow = "";
    sNow += String(vNow.getFullYear());
    sNow += String(vNow.getMonth() + 1);
    sNow += String(vNow.getDate());
    sNow += String(vNow.getHours());
    sNow += String(vNow.getMinutes());
    sNow += String(vNow.getSeconds());
    sNow += String(vNow.getMilliseconds());
    return sNow;
}